<?php
/**
 * Created by PhpStorm.
 * User: zhangrxiang
 * Date: 17-2-7
 * Time: 下午4:01
 */


//连接本地的 Redis 服务
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
echo "Connection to server sucessfully";
//查看服务是否运行
echo "Server is running: " . $redis->ping();
echo nl2br(PHP_EOL);



$redis->set("name","zing");
$str = $redis->get("name");
echo $str;


$memcache = new Memcached;//创建一个memcache对象

$memcache->addServer("localhost",11211);
//$memcache->connect('localhost', 11211) or die ("Could not connect"); //连接Memcached服务器
$memcache->set('key', 'test');        //设置一个变量到内存中，名称是key 值是test
$get_value = $memcache->get('key');   //从内存中取出key的值
echo nl2br(PHP_EOL);
echo $get_value;


